From 41c42dd82b3eece25fd56b63a8511b0ace8661b9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 7 Aug 2004 16:45:24 +0000 Subject: [PATCH] (completion-root-regexp): New defvar. (completion-setup-function): Use it instead of a literal string. --- lisp/simple.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 1e112b1be74..b52220d542b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4304,6 +4304,12 @@ make the common parts less visible than normal, so that the rest of the differing parts is, by contrast, slightly highlighted." :group 'completion) +;; This is for packages that need to bind it to a non-default regexp +;; in order to make the first-differing character highlight work +;; to their liking +(defvar completion-root-regexp "^/" + "Regexp to use in `completion-setup-function' to find the root directory.") + (defun completion-setup-function () (let ((mainbuf (current-buffer)) (mbuf-contents (minibuffer-contents))) @@ -4332,7 +4338,7 @@ of the differing parts is, by contrast, slightly highlighted." (with-current-buffer mainbuf (save-excursion (goto-char (point-max)) - (skip-chars-backward "^/") + (skip-chars-backward completion-root-regexp) (- (point) (minibuffer-prompt-end))))) ;; Otherwise, in minibuffer, the whole input is being completed. (if (minibufferp mainbuf) -- 2.30.2